<template>
	<div>
		<text class="form-title">账务记录信息</text>
		<FinRecForm @changePicker="changePicker" :formInline="formInline" :formItem="formItem"></FinRecForm>
	</div>
</template>

<script>
	import FinRecForm from "../../components/current/vForm.vue";

	export default {
		components: {
			FinRecForm
		},
		data() {
			return {
				//表格参数
				formItem: [{
						type: 'picker',
						pickerType: '',
						label: "账务项目",
						placeholder: "请选择账务项目",
						array: ['第一个', '第二个', '第三个'],
						index: "",
						clumn: 'item'
					},
					{
						type: 'radio',
						label: "账务类型",
						options:[{
							index:'1',
							value:'man',
							text:'男',
							checked:'checked'
						},{
							index:'2',
							value:'woman',
							text:'女',
						}],
						clumn: 'unit'
					},
					{
						type: 'input',
						label: "往来单位",
						placeholder: "请输入往来单位",
						clumn: 'unit'
					},
					{
						type: 'input',
						label: "金额",
						inputType:'digit',
						placeholder: "请输入金额",
						clumn: 'price'
					},
					{
						type: 'picker',
						pickerType: 'date',
						label: "操作时间",
						placeholder: "请选择操作时间",
						index: '',
						clumn: 'time'
					},
					{
						type: 'textarea',
						placeholder: "请输入详细内容",
						clumn: 'detailInfo'
					}
				],
				//表单字段数据
				formInline: {
					item: "",
					unit: "",
					price: "",
					time: "",
					detailInfo: "",
				},
				
			};
		},
		methods: {
			// 选择器发生改变时
			changePicker(i, clumn, value) {
				// 普通选择器赋值
				if (this.formItem[i].pickerType == '' || this.formItem[i].pickerType == 'selector') {
					this.formInline[clumn] = this.formItem[i].array[value];
					return
				}
				//时间选择器赋值
				if (this.formItem[i].pickerType == 'date') {
					this.formInline[clumn] = value;
					return
				}
			},
		}
	};
</script>

<style>
	.form-title {
		padding: 0 5%;
		color: rgb(136, 136, 136);
		line-height: 60rpx;
	}
</style>
